package com.example.controller;

import com.example.utils.MachineUtils;
import com.example.utils.MyLog;
import org.meowy.cqp.jcq.entity.CoolQ;
import org.meowy.cqp.jcq.message.CQCode;

/**
 * @author LEI
 * Created by LEI on 2020/3/30.
 */
public class MachineController {

    public String talk(String msg,Long fromGroup,Long fromQQ, CoolQ CQ){
        String reString = null;
        StringBuilder stringBuffer = new StringBuilder();
        if(msg.trim().startsWith("[CQ:at,qq=2563038558]")){
            reString = msg.replaceAll("[CQ:at,qq=2563038558]","");
        }

        String machineMsg = MachineUtils.getMachineMsg(reString);
        if(machineMsg != null){
            MyLog.log(stringBuffer.toString());
            CQCode CC = CQCode.getInstance();
            stringBuffer.append(CC.at(fromQQ)).append(" ").append(machineMsg);
            return stringBuffer.toString();
        }
        return null;
    }
}
